﻿<!doctype html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="description" content="event.html">
        <meta name="keywords" content="event,html,js">
        <title>javascript的程序开发之表单提交事件处理</title>
    </head>
    <body>
        <form action="pass.html" method="post" id="loginForm">
            登录邮箱：<input type="text" name="email" id="email"></input><br>
            <button type="submit" id="subBtn">登录</button>
        </form>
    </body>
	<script type="text/javascript">
		window.onload = function(){  
			document.getElementById('loginForm').addEventListener("submit",function(){
				var emailObj = document.getElementById("email");
				alert(emailObj.value);
				if (emailObj.value == "") {
					alert("您还有输入登录邮箱，无法登录！");
				}else{
					this.submit();
				}
			},false);
		}
	</script>
</html>


